package cn.taoticket.service;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import cn.taoticket.mapper.TaoticketItemCommentMapper;
import cn.taoticket.pojo.TaoticketItemComment;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by taoticket
 */
@RestController
public class RestTaoticketItemCommentService {

    @Resource
     private TaoticketItemCommentMapper taoticketItemCommentMapper;

     @RequestMapping(value = "/getTaoticketItemCommentById",method = RequestMethod.POST)
     public TaoticketItemComment getTaoticketItemCommentById(@RequestParam("id") Long id)throws Exception{
        return taoticketItemCommentMapper.getTaoticketItemCommentById(id);
     }

     @RequestMapping(value = "/getTaoticketItemCommentListByMap",method = RequestMethod.POST)
     public List<TaoticketItemComment>	getTaoticketItemCommentListByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketItemCommentMapper.getTaoticketItemCommentListByMap(param);
     }

     @RequestMapping(value = "/getTaoticketItemCommentCountByMap",method = RequestMethod.POST)
     public Integer getTaoticketItemCommentCountByMap(@RequestParam Map<String,Object> param)throws Exception{
        return taoticketItemCommentMapper.getTaoticketItemCommentCountByMap(param);
     }

     @RequestMapping(value = "/qdtxAddTaoticketItemComment",method = RequestMethod.POST)
     public Integer qdtxAddTaoticketItemComment(@RequestBody TaoticketItemComment taoticketItemComment)throws Exception{
        taoticketItemComment.setCreatedTime(new Date());
        return taoticketItemCommentMapper.insertTaoticketItemComment(taoticketItemComment);
     }

     @RequestMapping(value = "/qdtxModifyTaoticketItemComment",method = RequestMethod.POST)
     public Integer qdtxModifyTaoticketItemComment(@RequestBody TaoticketItemComment taoticketItemComment)throws Exception{
        taoticketItemComment.setUpdatedTime(new Date());
        return taoticketItemCommentMapper.updateTaoticketItemComment(taoticketItemComment);
     }
}
